home *** CD-ROM | disk | FTP | other *** search
- /* (C) Copyright 1991 Dave Fritsche (wb8zxu), All Rights Reserved.
- *
- * Redistribution and use in source and binary forms are permitted for
- * non-commercial use, provided that the above copyright notice and this
- * paragraph are duplicated in all such forms. THIS SOFTWARE IS PROVIDED
- * ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
- #include <stdio.h>
- #include <dir.h>
- #include "screen.h"
-
- mk_bmrc()
- {
- FILE *bmrc;
- unsigned char buf[128], drive[MAXDRIVE], dir[MAXDIR], fname[MAXFILE];
- unsigned char ext[MAXEXT], tmp[10];
- int n;
-
- n = fnsplit(path, drive, dir, fname, ext);
- if (n & DRIVE)
- sprintf(buf, "%s\\bm.rc", drive);
- else
- sprintf(buf, "\\bm.rc");
-
- if (debug)
- {
- printf("***> BM.RC file (%s):\n", buf);
- bmrc = stdout;
- }
- else
- {
- if ( (bmrc = fopen(buf, "r")) != NULL )
- {
- printf("\n(%s) already exists, overwrite (y/n)? ",buf);
- scanf("%s", tmp);
- if ( (tmp[0] != 'y') && (tmp[0] != 'Y') )
- {
- fclose(bmrc);
- return 0;
- }
- }
- fclose(bmrc);
- if ( (bmrc = fopen(buf, "w")) == NULL )
- {
- printf("\nCan't open \"%s\" for write, aborting!\n\n", buf);
- exit(-1);
- }
- }
-
- fprintf(bmrc, "# configuration file for Bdale's Mailer... format is:\n");
- fprintf(bmrc, "# host <space> this_host_name\n");
- fprintf(bmrc, "# user <space> this_user_name\n");
- fprintf(bmrc, "# fullname <space> your full name for mail headers (optional)\n");
- fprintf(bmrc, "# reply <space> your reply address if not this machine (optional)\n");
- fprintf(bmrc, "# useful for pc on large network off smart hosts\n");
- fprintf(bmrc, "# smtp <space> path to mailboxes default /spool/mail\n");
- fprintf(bmrc, "# edit <space> path your editor (optional)\n");
- fprintf(bmrc, "# mbox <space> name of file used as default for s command (optional)\n");
- fprintf(bmrc, "# folder <space> name of directory for save mailby s command (optional)\n");
- fprintf(bmrc, "# mqueue <space> name of directory for outgoing messages\n");
- fprintf(bmrc, "# record <space> name of file save a copy of sent mail (optional)\n");
- fprintf(bmrc, "# maxlet <space> max number of message in mbox ( optional default 300)\n");
- fprintf(bmrc, "# screen direct | bios video mode ( turbo C only default direct )\n");
- fprintf(bmrc, "#\n");
- fprintf(bmrc, "host %s\n", callsign);
- fprintf(bmrc, "user %s\n", callsign);
- fprintf(bmrc, "fullname %s, %s, %s [%ld.%ld.%ld.%ld]\n", name, city,
- state, ((ip >> 24) & 0xff), ((ip >> 16) & 0xff),
- ((ip >> 8) & 0xff), (ip & 0xff) );
- fprintf(bmrc, "reply %s@%s\n", callsign, callsign);
- fprintf(bmrc, "screen bios\n");
- fprintf(bmrc, "edit %s\n", editor);
- fprintf(bmrc, "smtp %s\\spool\\mail\n", path);
- fprintf(bmrc, "mbox %s\\spool\\mbox\n", path);
- fprintf(bmrc, "folder %s\\spool\n", path);
- fprintf(bmrc, "mqueue %s\\spool\\mqueue\n", path);
- fprintf(bmrc, "maxlet 400\n");
-
- if (!debug)
- fclose(bmrc);
- }
-